package com.distribution.common.annotation.valid;

import cn.hutool.core.lang.Validator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @author: GodLu
 * @create: 2024-05-08 14:48
 * @description: TODO
 */
public class MobilePhoneValidator implements ConstraintValidator<MobilePhone, String> {

    @Override
    public void initialize(MobilePhone constraintAnnotation) {
        // 初始化方法，通常不需要做太多事情
    }

    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        return Validator.isMobile(value);
    }
}
